var express           = require('express');
var router            = express.Router();
var projectAPI    = require('../api/v2/project.js');
var memberAPI    = require('../api/v2/member.js');
var certAPI    = require('../api/v2/cert.js');
var userAPI  = require('../api/v2/user.js');
var workspaceAPI = require('../api/v2/workspace');
var local_repoAPI    = require('../api/v2/local_repositories.js');
var buildConfigAPI    = require('../api/v2/build_cfg.js');

router.get('/user',userAPI.getCurrent);

router.post('/project', projectAPI.addProject);
router.delete('/project/removeCert',projectAPI.removeCert);
router.get('/project', projectAPI.getCurrentProject);
router.delete('/project/:project_id',projectAPI.deleteProject);
router.post('/cert/:project_id',certAPI.addCert);
//router.put('/cert/:cert_id',certAPI.updateCert); //todo

router.post('/dependency/:project_id',projectAPI.addDependency);
router.delete('/dependency/:project_id',projectAPI.removeDependency);
router.put('/dependency/:project_id',projectAPI.updateDependency);
router.put('/dependencies/:project_id',projectAPI.updateDependencies);

router.post('/member', memberAPI.addMember);
router.post('/members', memberAPI.getMembersByshoutids);
router.delete('/member', memberAPI.removeMember);
router.put('/member', memberAPI.updateMember);

router.post('/workspace/add',workspaceAPI.addWorkspace);
router.post('/workspace/delete',workspaceAPI.deleteWorkspace);
router.delete('/workspace/member/:workspace_id',workspaceAPI.removeWkpMember);
router.post('/workspace/member/:workspace_id',workspaceAPI.addWkpMember);
router.put('/workspace/member/:workspace_id',workspaceAPI.editWkpMember);
router.post('/workspace/dependencies/update',workspaceAPI.updateTarget);

router.post('/local_repo/download',local_repoAPI.download);
router.put('/local_repo/update',local_repoAPI.update);

router.post('/builds/', buildConfigAPI.start);

module.exports = router;


